﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using Stimulsoft;
using Stimulsoft.Report;
using Stimulsoft.Report.Dictionary;

namespace HotelManagement
{
    public partial class MainFRM : Form
    {
        public MainFRM()
        {
            InitializeComponent();
        }

        private void MainFRM_Load(object sender, EventArgs e)
        {
            if (Globals.GetUserRole() == "user")
            {
                اتاقهاToolStripMenuItem.Visible = false;
                کاربرانToolStripMenuItem.Visible = false;
                تعریفسرویسهایاضافهToolStripMenuItem.Visible = false;
            }

            else 
            {
                اتاقهاToolStripMenuItem.Visible = true;
                کاربرانToolStripMenuItem.Visible = true;
                تعریفسرویسهایاضافهToolStripMenuItem.Visible = true;
            }


            toolStripUsername.Text = "نام کاربر : " + Globals.GetUserName();

            PersianCalendar PC = new PersianCalendar();
            string shamsidate =
                PC.GetYear(DateTime.Now).ToString() + "/" +
                PC.GetMonth(DateTime.Now).ToString() + "/" +
                PC.GetDayOfMonth(DateTime.Now).ToString();

            toolStripDate.Text = "تاریخ : " + shamsidate;

            toolStripTime.Text = DateTime.Now.ToLongTimeString();

            toolStripUserRole.Text  = "گروه کاربری : " + Globals.GetUserRole();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            toolStripTime.Text = DateTime.Now.ToLongTimeString();
        }

        private void رزروجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ReserveFrm rf = new ReserveFrm();
            rf.ShowDialog();
        }

        private void جستجویرزروهایثبتشدهToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ReserveSerach rs = new ReserveSerach();
            rs.ShowDialog();
        }

        private void ثبتمهمانجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewGust guest = new NewGust();
            guest.ShowDialog();
        }

        private void جستجویمهمانانToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CustomerSearchFRM csf = new CustomerSearchFRM();
            csf.ShowDialog();
        }

        private void ثبتاتاقجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RoomsFRM rf = new RoomsFRM();
            rf.ShowDialog();
        }

        private void تعریفنوعاتاقToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RoomsAttributes ra = new RoomsAttributes();
            ra.ShowDialog();
        }

        private void تعریفقیمتاتاقهاToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RoomPriceFRM rpf = new RoomPriceFRM();
            rpf.ShowDialog();
        }

        private void ثبتسرویساضافهToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GetExtraService gs = new GetExtraService();
            gs.ShowDialog();
        }

        private void تعریفسرویسهایاضافهToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ServiceFRM sf = new ServiceFRM();
            sf.ShowDialog();
        }

        private void چاپفاکتورپرداختToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ReserveSerach rsf = new ReserveSerach();
            rsf.ShowDialog();

            FactorExportation["rs_id"] = rsf.Rs_ID;
            FactorExportation["c_id"] = rsf.c_id;
            FactorExportation["rm_id"] = rsf.rm_id;
            FactorExportation["f_id"] = rsf.f_id;


            FactorExportation.Dictionary.Variables.Add(new StiVariable("Category", "op", typeof(string), Globals.GetUserName(), false));

            FactorExportation.Render();
            FactorExportation.Show();
        }

        private void مهمانانToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            CustomerReport.Dictionary.Variables.Add(new StiVariable("Category", "op", typeof(string), Globals.GetUserName(), false));

            CustomerReport.Show();
        }

        private void رزروهایانجامشدهToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ReserveReport.Dictionary.Variables.Add(new StiVariable("Category", "op", typeof(string), Globals.GetUserName(), false));

            ReserveReport.Show();
        }

        private void همراهانToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            PersonsReport.Dictionary.Variables.Add(new StiVariable("Category", "op", typeof(string), Globals.GetUserName(), false));

            PersonsReport.Show();
        }

        private void عملیاتپرداختToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PaymentFRM pf = new PaymentFRM();
            pf.ShowDialog();
        }

        private void ثبتکاربرجدیدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UsersFrm us = new UsersFrm();
            us.ShowDialog();
        }

        private void گزارشاتToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LogFRM lg = new LogFRM();
            lg.ShowDialog();
        }
    }
}
